package com.nuumoblie.bluetoothtools.ble.db;

import android.content.Context;
import android.util.Log;

import com.nuumoblie.bluetoothtools.ble.db.entity.BleCharacteristicEntity;
import com.nuumoblie.bluetoothtools.ble.db.entity.BleDescriptorEntity;
import com.nuumoblie.bluetoothtools.ble.db.entity.BleProductTypeEntity;
import com.nuumoblie.bluetoothtools.ble.db.entity.BleServiceEntity;

import java.util.UUID;

public class InitDatabase {

    public static void initDatabase(Context context) {
        Log.v("lmjssjj","initDatabase");
        BleProductTypeEntity entity = new BleProductTypeEntity(1, "1",
                true, true, 1, 1, true, 0);

        AdvertiseDatabase.getInstance(context).getProductDao().delete(entity);
        AdvertiseDatabase.getInstance(context).getProductDao().insert(entity);

        BleServiceEntity serviceEntity = new BleServiceEntity(1,UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"),
                "a",1,1);
        AdvertiseDatabase.getInstance(context).getServiceDao().delete(serviceEntity);
        AdvertiseDatabase.getInstance(context).getServiceDao().insert(serviceEntity);
        AdvertiseDatabase.getInstance(context).getServiceDao().insert(serviceEntity);
        AdvertiseDatabase.getInstance(context).getServiceDao().insert(serviceEntity);
        AdvertiseDatabase.getInstance(context).getServiceDao().insert(serviceEntity);
        AdvertiseDatabase.getInstance(context).getServiceDao().insert(serviceEntity);

        BleCharacteristicEntity characteristicEntity = new BleCharacteristicEntity(1,UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"),
                "s",1,1);
        AdvertiseDatabase.getInstance(context).getCharacteristicDao().insert(characteristicEntity);
        AdvertiseDatabase.getInstance(context).getCharacteristicDao().insert(characteristicEntity);
        AdvertiseDatabase.getInstance(context).getCharacteristicDao().insert(characteristicEntity);


        BleDescriptorEntity descriptorEntity = new BleDescriptorEntity(1,UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"),
                "s",1,1);
        AdvertiseDatabase.getInstance(context).getDescriptorDao().insert(descriptorEntity);
        AdvertiseDatabase.getInstance(context).getDescriptorDao().insert(descriptorEntity);
        AdvertiseDatabase.getInstance(context).getDescriptorDao().insert(descriptorEntity);
        AdvertiseDatabase.getInstance(context).getDescriptorDao().insert(descriptorEntity);
        AdvertiseDatabase.getInstance(context).getDescriptorDao().insert(descriptorEntity);
    }

}
